﻿using Microsoft.EntityFrameworkCore;
using System.Reflection.Emit;
using Volo.Abp.AuditLogging;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement;
using Volo.Abp.TenantManagement.EntityFrameworkCore;

namespace YDT_ABPvNext_Projects.Data;

[ConnectionStringName("Default")]
public class YDT_ABPvNext_ProjectsDbContext : AbpDbContext<YDT_ABPvNext_ProjectsDbContext>
{
    public YDT_ABPvNext_ProjectsDbContext(DbContextOptions<YDT_ABPvNext_ProjectsDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        /* Include modules to your migration db context */

        //builder.ConfigurePermissionManagement();
        ////builder.ConfigureSettingManagement();
        //builder.ConfigureAuditLogging();
        //builder.ConfigureIdentity();
        ////builder.ConfigureOpenIddict();
        ////builder.ConfigureFeatureManagement();
        //builder.ConfigureTenantManagement();

        ////配置应用权限模块
        //模型表前缀
        AbpPermissionManagementDbProperties.DbTablePrefix = "YDT_";
        builder.ConfigurePermissionManagement();

        //配置应用身份认证模块
        //模型表前缀
        AbpIdentityDbProperties.DbTablePrefix = "YDT_";
        builder.ConfigureIdentity();

        //配置应用租户模块
        AbpTenantManagementDbProperties.DbTablePrefix = "YDT_";
        builder.ConfigureTenantManagement();

        //配置审计日志模块
        AbpAuditLoggingDbProperties.DbTablePrefix = "YDT_";
        builder.ConfigureAuditLogging();

        /* Configure your own entities here */
    }
}
